import { BEAS_URL } from '../../utils/beas.js'

export function request(config) {
        wx.showLoading({
          title: '加载中...',
        })
        return new Promise((resolve, resject) => {
                wx.request({
                        url: BEAS_URL + config.url,
                        method: config.method || "GET",
                        data: config.data,
                        header: config.header,
                        timeout: config.timeout,
                        success: (res) => {
                                resolve(res)
                                wx.hideLoading()
                        },
                        fail: (err) => {
                                resject(err)
                        }
                })
        })

}